package vn.keho.module.dompeto.utils;

import android.app.Activity;
import android.content.Intent;
import android.widget.LinearLayout;
import android.widget.ListView;

import com.bingkaimedia.merchantbeta.R;

/**
 * Created by KeHo on 2/3/15.
 */
public class ThemeUtil {
    public static int sTheme;

    public final static int THEME_FIRST = 0;
    public final static int THEME_SECOND = 1;

    public final static int MAX_THEME = 2;

    /**
     * Set the theme of the Activity, and restart it by creating a new Activity of the same type.
     */
    public static void changeToTheme(LinearLayout drawerLayoutContent, int theme)
    {
        sTheme = theme;
        onActivityCreateSetTheme(drawerLayoutContent);
    }

    /** Set the theme of the activity, according to the configuration. */
    public static void onActivityCreateSetTheme(LinearLayout drawerLayoutContent)
    {
        switch (sTheme)
        {
            default:
            case THEME_FIRST:
                drawerLayoutContent.setBackgroundResource(R.drawable.theme_1);
                break;
            case THEME_SECOND:
                drawerLayoutContent.setBackgroundResource(R.drawable.theme_2);
                break;
        }
    }

    public static void setDividerTheme(ListView lv) {
        switch (sTheme)
        {
            default:
            case THEME_FIRST:
                lv.setDivider(lv.getResources().getDrawable(R.drawable.channel_divider_them1));
                lv.setDividerHeight(30);
                break;
            case THEME_SECOND:
                lv.setDivider(lv.getResources().getDrawable(R.drawable.channel_divider_them2));
                lv.setDividerHeight(30);
                break;
        }


    }
}
